package com.lagou.controller;

import com.github.pagehelper.PageInfo;
import com.lagou.pojo.Article;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping("/selectArticleList")
    public String selectArticleList(Model model, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                    @RequestParam(value = "pageSize",defaultValue = "3") int pageSize){
        PageInfo<Article> articlePageInfo = articleService.selectArticleList(pageNum, pageSize);
        model.addAttribute("articlePageInfo",articlePageInfo);
        return "client/index";
    }

}
